import Qt 4.7
import "content" as Twitter

Rectangle {
    id: main
    x:0; y:0; width: 800; height: 480 // N900 resolution
    Twitter.Background { }                       
    Twitter.TwitterModel { id:twitterModel }     
    Twitter.SearchView { id:searchView }
    Twitter.ColumnView { id:mainView }
    Twitter.ButtonBar { id:buttonBar }

  state: "SearchState"  
    states: [            
    State {                                              
        name: "SearchState"                               
        PropertyChanges { target:searchView; opacity: 1 } 
        PropertyChanges { target:mainView;  opacity: 0 } 
    },                                                   
    State {                                              
        name: "MainState"                                
        PropertyChanges { target:searchView; opacity: 0 } 
        PropertyChanges { target:mainView;  opacity: 1 } 
    }                                                    
    ]                                                    
     
    transitions: [                                       
    Transition {                                          
        reversible: true                                  
        from: "*"; to: "*"                                
        PropertyAnimation { properties: "opacity"; duration: 1000; easing.type: "InOutQuad";} 
    }    
    ]                                                       

    function search (searchPhrase) {
        console.log( "search: " + searchPhrase );
        main.state = "MainState";              
        twitterModel.searchPhrase = searchPhrase;
        twitterModel.refresh();                  
    }
}